<!-- 正文开始 -->
<div class="layui-fluid">
  <div class="layui-card">
    <div class="layui-card-body">
      <!-- 表格工具栏 -->
      <form class="layui-form toolbar" lay-filter="appointmentsTbSearchForm">
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">姓&emsp;名:</label>
            <div class="layui-input-inline">
              <input name="name" class="layui-input search_key" placeholder="输入账号" autocomplete="off"/>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">审&emsp;核:</label>
            <div class="layui-input-inline">
              <select name="examined" lay-filter="examined" lay-verify="" lay-search="">
                <option value="">所有</option>
                <option value="未审核">未审核</option>
                <option value="未通过">未通过</option>
                <option value="已审核">已审核</option>
              </select>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">标&emsp;签:</label>
            <div class="layui-input-inline">
              <select name="labeled" lay-filter="labeled" lay-verify="" lay-search="">
                <option value="">无</option>
                <option value="有">有</option>
                <option value="优质">优质</option>
                <option value="帅气">帅气</option>
                <option value="多金">多金</option>
                <option value="漂亮">漂亮</option>
                <option value="有才">有才</option>
              </select>
            </div>
          </div>
          <div class="layui-inline">&emsp;
            <button class="layui-btn icon-btn" lay-filter="appointmentsTbSearch"
              id="appointmentsTbSearch" lay-submit>
              <i class="layui-icon">&#xe615;</i>搜索
            </button>
          </div>
        </div>
      </form>
      <!-- 数据表格 -->
      <table id="appointmentsTable" lay-filter="appointmentsTable"></table>
    </div>
  </div>
</div>
<!-- 表格行里的操作列 -->
<script type="text/html" id="appointmentsTbBar">
  <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>
  <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="pay">缴费</a>
  <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="intro">介绍</a>
  <!--<a class="layui-btn layui-btn-danger layui-btn-xs"
    data-dropdown="#appointmentsTbDelDrop{{d.LAY_INDEX}}" no-shade="true">删除</a>
  <div class="dropdown-menu-nav dropdown-popconfirm dropdown-top-right layui-hide"
    id="appointmentsTbDelDrop{{d.LAY_INDEX}}"
    style="max-width: 200px;white-space: normal;min-width: auto;margin-left: 10px;">
    <div class="dropdown-anchor"></div>
    <div class="dropdown-popconfirm-title">
      <i class="layui-icon layui-icon-help"></i>
      确定要删除{{d.name}}吗？
    </div>
    <div class="dropdown-popconfirm-btn">
        <a class="layui-btn" btn-cancel>取消</a>
        <a class="layui-btn layui-btn-normal" lay-event="del">确定</a>
    </div>
  </div>-->
</script>
<!-- 用户资料添加修改表单弹窗 -->
<script type="text/html" id="appointmentsEditDialog">
<form id="appointmentsEditForm" lay-filter="appointmentsEditForm" class="layui-form model-form">
  <input name="id" id="id" type="hidden"/>
  <input name="organizationId" type="hidden"/>
  <div class="layui-form-item layui-row">
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">昵称</label>
      <div class="layui-input-block">
        <input id="name" name="name" type="text" class="layui-input"  autocomplete="off"
        lay-verType="tips" lay-verify="required" placeholder="请输入昵称"/>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">性别</label>
      <div class="layui-input-block">
        <select id="gender" name="gender" lay-filter="gender" lay-verify="" lay-search="">
          <option value="1">男</option>
          <option value="2">女</option>
        </select>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">手机</label>
      <div class="layui-input-block">
        <input id="phone" name="phone" type="text" class="layui-input"  autocomplete="off"
        lay-verType="tips" lay-verify="required" placeholder="请输入手机"/>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">微信</label>
      <div class="layui-input-block">
        <input id="wechatCode" name="wechatCode" type="text" class="layui-input"  autocomplete="off"
               lay-verType="tips" lay-verify="required" placeholder="请输入微信"/>
      </div>
    </div>
  </div>
  <div class="layui-form-item layui-row">
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">身高</label>
      <div class="layui-input-block">
        <input id="height" name="height" type="number" class="layui-input"  autocomplete="off"
        lay-verType="tips" lay-verify="required" placeholder="请输入身高"/>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">体重</label>
      <div class="layui-input-block">
        <input id="weight" name="weight" type="number" class="layui-input"  autocomplete="off"
        lay-verType="tips" lay-verify="required" placeholder="请输入体重"/>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">学历</label>
      <div class="layui-input-block">
        <select id="education" name="education" lay-filter="education" lay-verify="" lay-search="">
          <option value="博士">博士</option>
          <option value="研究生">研究生</option>
          <option value="本科">本科</option>
          <option value="大专">大专</option>
          <option value="其他">其他</option>
        </select>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">生日</label>
      <div class="layui-input-block">
        <input id="birthday" name="birthday" type="text" class="layui-input"  autocomplete="off"
               lay-verType="tips" lay-verify="required" placeholder="请输入生日"/>
      </div>
    </div>
  </div>
  <div class="layui-form-item layui-row">
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">职业</label>
      <div class="layui-input-block">
        <input id="occupation" name="occupation" type="text" class="layui-input"  autocomplete="off"
        lay-verType="tips" lay-verify="required" placeholder="请输入职业"/>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">年薪(万)</label>
      <div class="layui-input-block">
        <input id="salary" name="salary" type="number" class="layui-input"  autocomplete="off"
        lay-verType="tips" lay-verify="required" placeholder="请输入年薪"/>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">房子</label>
      <div class="layui-input-block">
        <input id="house" name="house" type="text" class="layui-input"  autocomplete="off"
        lay-verType="tips" lay-verify="required" placeholder="在哪里/多少平方"/>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">车子</label>
      <div class="layui-input-block">
        <input id="car" name="car" type="text" class="layui-input"  autocomplete="off"
        lay-verType="tips" lay-verify="required" placeholder="请输入车子"/>
      </div>
    </div>
  </div>
  <div class="layui-form-item layui-row">
    <div class="layui-col-md3">
      <label class="layui-form-label ">自身情况</label>
      <div class="layui-input-block">
        <input id="selfSituation" name="selfSituation" type="text" class="layui-input"  autocomplete="off"
        lay-verType="tips" lay-verify="" placeholder="请输入自身情况"/>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">父母情况</label>
      <div class="layui-input-block">
        <input id="parentsSituation" name="parentsSituation" type="text" class="layui-input"  autocomplete="off"
        lay-verType="tips" lay-verify="required" placeholder="请输入父母情况"/>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">爱好</label>
      <div class="layui-input-block">
        <input id="hobby" name="hobby" type="text" class="layui-input"  autocomplete="off"
        lay-verType="tips" lay-verify="required" placeholder="请输入爱好"/>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">择偶要求</label>
      <div class="layui-input-block">
        <input id="requirements" name="requirements" type="text" class="layui-input"  autocomplete="off"
        lay-verType="tips" lay-verify="required" placeholder="请输入择偶要求"/>
      </div>
    </div>

  </div>
  <div class="layui-form-item layui-row">
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">籍贯</label>
      <div class="layui-input-block">
        <input id="nativePlaceV" name="nativePlaceV" type="text" class="layui-hide"  autocomplete="off"
        lay-verType="tips" lay-verify="required" placeholder="请输入籍贯"/>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">居住</label>
      <div class="layui-input-block">
        <input id="liveCityV" name="liveCityV" type="text" class="layui-input"  autocomplete="off"
        lay-verType="tips" lay-verify="required" placeholder="请输入居住"/>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">是否独生</label>
      <div class="layui-input-block">
        <select id="onlySon" name="onlySon" lay-filter="onlySon" lay-verify="" lay-search="">
          <option value="1">是</option>
          <option value="2">否</option>
        </select>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">婚姻</label>
      <div class="layui-input-block">
        <select id="marriage" name="marriage" lay-filter="marriage" lay-verify="" lay-search="">
          <option value="未婚">未婚</option>
          <option value="离异无孩">离异无孩</option>
          <option value="离异有孩">离异有孩</option>
        </select>
      </div>
    </div>
  </div>
<!--  <div class="layui-form-item layui-row">
    <div class="layui-col-md3">
      <label class="layui-form-label layui-form-required">身份证</label>
      <div class="layui-input-block">
        <input id="idCard" name="idCard" type="text" class="layui-input"  autocomplete="off"
        lay-verType="tips" lay-verify="" placeholder="请输入身份证"/>
      </div>
    </div>
  </div>-->
  <div class="layui-form-item layui-row">
    <div class="layui-col-md3">
      <label class="layui-form-label">是否显示个人照片</label>
      <div class="layui-input-block">
        <select id="showPhoto" name="showPhoto" lay-filter="showPhoto" lay-verify="" lay-search="">
          <option value="1">显示</option>
          <option value="0">不显示</option>
        </select>
      </div>
    </div>
    <div class="layui-col-md3">
      <label class="layui-form-label ">标签</label>
      <div class="layui-input-block">
        <select id="labeled" name="labeled" lay-filter="labeled" lay-verify="" lay-search="">
          <option value="无">无</option>
          <option value="优质">优质</option>
          <option value="帅气">帅气</option>
          <option value="多金">多金</option>
          <option value="漂亮">漂亮</option>
          <option value="有才">有才</option>
        </select>

      </div>
    </div>
  </div>
  <!--<div class="layui-form-item layui-row">
    <div class="layui-col-md12">
      <label class="layui-form-label">身份证照片</label>
      <div class="layui-input-block">
        <button type="button" class="layui-btn" id="idCardPic_upload">
          <i class="layui-icon">&#xe67c;</i>上传图片
        </button>
        <input id="idCardPic_pic" name="idCardPic" type="text" class="layui-input layui-hide" autocomplete="off"
               lay-verType="tips" lay-verify="" placeholder="请输入照片"/>
        <input id="idCardPic_picRemove" name="idCardPicRemove" type="text"
               class="layui-input layui-hide" autocomplete="off"
               lay-verType="tips" lay-verify="" placeholder="请输入照片"/>
        <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
          预览图：
          <div class="layui-upload-list" id="idCardPic_preview"></div>
        </blockquote>
      </div>
    </div>
  </div>
  <div class="layui-form-item layui-row">
    <div class="layui-col-md12">
      <label class="layui-form-label">学历照片</label>
      <div class="layui-input-block">
        <button type="button" class="layui-btn" id="educationPic_upload">
          <i class="layui-icon">&#xe67c;</i>上传图片
        </button>
        <input id="educationPic_pic" name="educationPic" type="text" class="layui-input layui-hide" autocomplete="off"
               lay-verType="tips" lay-verify="" placeholder="请输入照片"/>
        <input id="educationPic_picRemove" name="educationPicRemove" type="text"
               class="layui-input layui-hide" autocomplete="off"
               lay-verType="tips" lay-verify="" placeholder="请输入照片"/>
        <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
          预览图：
          <div class="layui-upload-list" id="educationPic_preview"></div>
        </blockquote>
      </div>
    </div>
  </div>-->
  <div class="layui-form-item layui-row">
    <div class="layui-col-md12">
      <label class="layui-form-label">个人照片</label>
      <div class="layui-input-block">
        <button type="button" class="layui-btn" id="photo_upload">
          <i class="layui-icon">&#xe67c;</i>上传图片
        </button>
        <input id="photo_pic" name="photo" type="text" class="layui-input layui-hide" autocomplete="off"
               lay-verType="tips" lay-verify="" placeholder="请输入照片"/>
        <input id="photo_picRemove" name="photoRemove" type="text"
               class="layui-input layui-hide" autocomplete="off"
               lay-verType="tips" lay-verify="" placeholder="请输入照片"/>
        <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
          预览图：
          <div class="layui-upload-list" id="photo_preview"></div>
        </blockquote>
      </div>
    </div>

  </div>
  <div class="layui-form-item layui-row">
    <div class="layui-col-md12">
      <label class="layui-form-label">隐藏照片</label>
      <div class="layui-input-block">
        <button type="button" class="layui-btn" id="photo_privacy_upload">
          <i class="layui-icon">&#xe67c;</i>上传图片
        </button>
        <input id="photo_privacy_pic" name="photoPrivacy" type="text" class="layui-input layui-hide" autocomplete="off"
               lay-verType="tips" lay-verify="" placeholder="请输入照片"/>
        <input id="photo_privacy_picRemove" name="photoPrivacyRemove" type="text"
               class="layui-input layui-hide" autocomplete="off"
               lay-verType="tips" lay-verify="" placeholder="请输入照片"/>
        <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
          预览图：
          <div class="layui-upload-list" id="photo_privacy_preview"></div>
        </blockquote>
      </div>
    </div>

  </div>
  <div class="layui-form-item text-right">
    <button class="layui-btn" lay-filter="appointmentsEditSubmit" lay-submit>保存</button>
    <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
  </div>
</form>
</script>
<!-- 缴费表单弹窗 -->
<script type="text/html" id="jfDialog">
<form id="jfForm" lay-filter="jfForm" class="layui-form model-form">
  <div class="layui-form-item layui-row">
    <div class="layui-col-md8">
      <label class="layui-form-label layui-form-required">缴费金额</label>
      <div class="layui-input-block">
        <input id="priceJf" name="price" type="text" class="layui-input" autocomplete="off"
               lay-verType="tips" lay-verify="numberX|required" maxlength="20" placeholder="请输入缴费金额"/>
      </div>
    </div>
<!--    <div class="layui-col-md4">-->
<!--      <label class="layui-form-label layui-form-required">缴费时间</label>-->
<!--      <div class="layui-input-block">-->
<!--        <input id="payTime" name="payTime" type="text" class="layui-input" autocomplete="off"-->
<!--               lay-verType="tips" lay-verify="" maxlength="20" placeholder="请输入缴费时间"/>-->
<!--      </div>-->
<!--    </div>-->
  </div>
  <div class="layui-form-item layui-row">
    <div class="layui-col-md12">
      <label class="layui-form-label">备注</label>
      <div class="layui-input-block">
         <textarea name="remark" id="jfRemark" placeholder="请输入备注" class="layui-textarea"
                   maxlength="300"></textarea>
      </div>
    </div>
  </div>
  <div class="layui-form-item text-right">
    <button class="layui-btn" lay-filter="jfEditSubmit" lay-submit>保存</button>
    <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
  </div>
</form>
</script>

<!-- 介绍表单弹窗 -->
<script type="text/html" id="introDialog">
  <form id="introForm" lay-filter="introForm" class="layui-form model-form">
    <div class="layui-form-item layui-row">
      <div class="layui-col-md8">
        <label class="layui-form-label">介绍时间</label>
        <div class="layui-input-block">
          <input id="introDate" name="introDate" type="text" class="layui-input" autocomplete="off"
                 lay-verType="tips" lay-verify="required" placeholder="请输入约见时间"/>
        </div>
      </div>
    </div>
    <div class="layui-form-item layui-row">
      <div class="layui-col-md8">
        <label class="layui-form-label">内容</label>
        <div class="layui-input-block">
         <textarea name="content" id="intro_content" placeholder="请输入内容" class="layui-textarea"
                   maxlength="300" lay-verify="required"></textarea>
        </div>
      </div>
    </div>
    <div class="layui-form-item text-right">
      <button class="layui-btn" lay-filter="introEditSubmit" lay-submit>保存</button>
      <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
    </div>
  </form>
</script>
<!-- 审核表单弹窗 -->
<script type="text/html" id="examineDialog">
  <form id="examineForm" lay-filter="examineForm" class="layui-form model-form">
    <div class="layui-form-item layui-row">
      <div class="layui-col-md8">
        <label class="layui-form-label">审核状态</label>
        <div class="layui-input-block">
          <select id="examine_examined" name="examined" lay-filter="examined" lay-verify="" lay-search="">
            <option value="未通过">未通过</option>
            <option value="已审核">已审核</option>
          </select>
        </div>
      </div>
    </div>
    <div class="layui-form-item layui-row">
      <div class="layui-col-md8">
        <label class="layui-form-label">内容(可不填)</label>
        <div class="layui-input-block">
         <textarea name="content" id="examine_content" placeholder="请输入内容" class="layui-textarea"
                   maxlength="300" lay-verify=""></textarea>
        </div>
      </div>
    </div>
    <div class="layui-form-item text-right">
      <button class="layui-btn" lay-filter="examineEditSubmit" lay-submit>保存</button>
      <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
    </div>
  </form>
</script>
<!-- 表格操作列 -->
<script type="text/html" id="idCardPicTbBar">
  {{#
  layui.each(d.idCardPic.split(","), function(index, item){
  if(item!=null && item != ''){
  }}
  <img data-index="{{index}}" data-src="/api/file/{{item}}" src= "{{layui.setter.baseServer}}/file/{{item}}" class="tb-img-circle" tb-img alt="" style="height: 24px;"/>
  {{#
  }
  })
  }}
</script>
<script type="text/html" id="educationPicTbBar">
  {{#
  layui.each(d.educationPic.split(","), function(index, item){
  if(item!=null && item != ''){
  }}
  <img data-index="{{index}}" data-src="/api/file/{{item}}" src="{{layui.setter.baseServer}}/file/{{item}}" class="tb-img-circle" tb-img alt="" style="height: 24px;"/>
  {{#
  }
  })
  }}
</script>
<script type="text/html" id="photoTbBar">
  {{#
  layui.each(d.photo.split(","), function(index, item){
  if(item!=null && item != ''){
  }}
  <img data-index="{{index}}" data-src="/api/file/{{item}}" src="{{layui.setter.baseServer}}/file/{{item}}" class="tb-img-circle" tb-img alt="" style="height: 24px;"/>
  {{#
  }
  })
  }}
</script>
<script type="text/html" id="photoPrivacyTbBar">
  {{#
  layui.each(d.photoPrivacy.split(","), function(index, item){
  if(item!=null && item != ''){
  }}
  <img data-index="{{index}}" data-src="/api/file/{{item}}" src="{{layui.setter.baseServer}}/file/{{item}}" class="tb-img-circle" tb-img alt="" style="height: 24px;"/>
  {{#
  }
  })
  }}
</script>
<!-- js部分 -->
<script type="text/javascript" src="assets/module/cascader/citys-data.js"></script>
<script>
layui.use(['layer', 'form', 'table', 'tableX', 'util', 'admin', 'xmSelect'
  , 'formX', 'dropdown', 'upload', 'setter', 'laydate'
  , 'cascader'
], function () {
  let $ = layui.jquery;
  let layer = layui.layer;
  let form = layui.form;
  let table = layui.table;
  let tableX = layui.tableX;
  let util = layui.util;
  let admin = layui.admin;
  let formX = layui.formX;
  let setter = layui.setter;
  let xmSelect = layui.xmSelect;
  let laydate = layui.laydate;
  let upload = layui.upload; //得到 upload 对象
  var cascader = layui.cascader;


  form.render('select', 'appointmentsTbSearchForm');

  /* 渲染表格 */
  let insTb = tableX.render({
    elem: '#appointmentsTable',
    url: setter.baseServer + '/appo/appointments/page',
    page: true,
    height: 'full-235',
    limits: [10,20,30,50,80,100,200],
    limit: 20 ,//每页默认显示的数量
    toolbar: ['<p>',
      '<button lay-event="add" class="layui-btn layui-btn-sm icon-btn"><i class="layui-icon">&#xe654;</i>添加</button>&nbsp;',
      '<button lay-event="examine" class="layui-btn layui-btn-sm icon-btn"><i class="layui-icon">&#xe6c6;</i>审核</button>&nbsp;',
      '<button lay-event="del" class="layui-btn layui-btn-sm layui-btn-danger icon-btn"><i class="layui-icon">&#xe640;</i>删除</button>&nbsp;',
      '</p>'].join(''),
    cellMinWidth: 100,
    cols: [[
      {type: 'checkbox'},
      {type: 'numbers'},
      {field: "examined",  title: "审核", sort: true, hide:false },
      {field: "bCode",  title: "编号", sort: true, hide:false },
      {field: "name",  title: "昵称", sort: true, hide:false },
      {field: "gender",  title: "性别", sort: true, hide:false, templet: function (d) {
        if(d.gender == 1){
          return '男';
        } else{
          return '女';
        }
      } },
      {field: "phone",  title: "手机", minWidth: "150", sort: true, hide:false },
<!--      {field: "idCardPic",  title: "身份证图片", toolbar: '#idCardPicTbBar', sort: true, hide:false },-->
<!--      {field: "educationPic",  title: "学历证书", toolbar: '#educationPicTbBar', sort: true, hide:false },-->
      {field: "photo",  title: "个人照", toolbar: '#photoTbBar', sort: true, hide:false },
      {field: "photoPrivacy",  title: "隐藏照", toolbar: '#photoPrivacyTbBar', sort: true, hide:false },
      {field: "height",  title: "身高", sort: true, hide:false },
      {field: "weight",  title: "体重", sort: true, hide:false },
      {field: "education",  title: "学历", sort: true, hide:false },
      {field: "occupation",  title: "职业", sort: true, hide:false },
      {field: "salary",  title: "年薪", sort: true, hide:false, templet: function (d) {
            return d.salary + '万';
      } },
      {field: "house",  title: "房子", sort: true, hide:false },
      {field: "car",  title: "车子", sort: true, hide:false },
      {field: "selfSituation",  title: "自身情况", sort: true, hide:false },
      {field: "hobby",  title: "爱好", sort: true, hide:false },
      {field: "requirements",  title: "择偶要求", sort: true, hide:false },
      {field: "birthday",  title: "生日", sort: true, hide:false ,templet: function (d) {
            return util.toDateString(d.birthday);
          }
      },
      {field: "onlySon",  title: "是否独子", sort: true, hide:false
        ,templet: function (d) {
          if(d.onlySon == 1){
            return '独子';
          } else{
            return '非独子';
          }
        }
      },
      {field: "parentsSituation",  title: "父母情况", sort: true, hide:false },
      {field: "marriage",  title: "婚姻", sort: true, hide:false },
      {field: "nativePlace",  title: "籍贯", sort: true, hide:false },
      {field: "liveCity",  title: "居住", sort: true, hide:false },
      {field: "wechatCode",  title: "微信", sort: true, hide:false },
      {field: "labeled",  title: "标签", sort: true, hide:false },
<!--      {field: "idCard",  title: "身份证", sort: true, hide:false },-->
<!--      {field: "educationPic",  title: "学历照片", sort: true, hide:false },-->
      // {field: "orderNum",  title: "排序", sort: true, hide:false },
      // {field: "createTime",  title: "创建时间", sort: true, hide:false ,templet: function (d) {
      //       return util.toDateString(d.createTime);
      //     }
      // },
      // {field: "createName",  title: "创建人", sort: true, hide:false },
      // {field: "updateTime",  title: "更新时间", sort: true, hide:false ,templet: function (d) {
      //       return util.toDateString(d.updateTime);
      //     }
      // },
      // {field: "updateName",  title: "更新人", sort: true, hide:false },
      // {field: "deleted",  title: "del(0正常 1删除)", sort: true, hide:true },
      {title: '操作', toolbar: '#appointmentsTbBar', align: 'center', minWidth: 200, fixed: 'right'}
    ]]
  });

  //监听行双击
  table.on('rowDouble(appointmentsTable)', function(obj){
    let data = obj.data;
    showEditModel(data);
    // obj.tr.find("a[lay-event=edit]").trigger("click");//会跳出来两个一样的框 这个不好用
    //obj.tr.toggleClass('layui-table-click').siblings().removeClass('layui-table-click');//选中行
  });

  $('.search_key').bind('keypress',function(event){
    if(event.keyCode == "13")
    {
      $("#appointmentsTbSearch").click();
    }
  });

  /* 表格搜索 */
  form.on('submit(appointmentsTbSearch)', function (data) {
    insTb.reload({where: data.field, page: {curr: 1}});
    return false;
  });

  /* 表格行里面 修改,删除点击事件 */
  table.on('tool(appointmentsTable)', function (obj) {
    if ('edit' === obj.event) { // 修改
      showEditModel(obj.data);
    } else if ('pay' === obj.event) { // 缴费
      pay(obj.data);
    } else if ('intro' === obj.event) { // 缴费
      intro(obj.data);
    } else if ('del' === obj.event) { // 删除
      doDel(obj);
    }
  });

  /* 表格头上面的工具栏点击事件 */
  table.on('toolbar(appointmentsTable)', function (obj) {
    if ('add' === obj.event) { // 添加
      showEditModel();
    } else if ('examine' === obj.event) { // 审核
      let checkRows = table.checkStatus('appointmentsTable');
      if (!checkRows || !checkRows.data || 0 === checkRows.data.length) {
        return layer.msg('请选择要审核的数据', {icon: 2, anim: 6});
      }
      let ids = '', keywords = ''
      checkRows.data.map(function (d) {
        ids = ids + d.id + ','
        keywords = keywords + d.appoUserId + ','
      });
      if(ids) {
        ids = ids.substr(0,ids.length -1)
        keywords = keywords.substr(0,keywords.length -1)
      }
      examine_dialog({ids, keywords});
    } else if ('del' === obj.event) { // 删除
      let checkRows = table.checkStatus('appointmentsTable');
      if (!checkRows || !checkRows.data || 0 === checkRows.data.length) {
        return layer.msg('请选择要删除的数据', {icon: 2, anim: 6});
      }
      let ids = '', receiverUser
      checkRows.data.map(function (d) {
        ids = ids + d.id + ','
      });
      if(ids) {
        ids = ids.substr(0,ids.length -1)
      }
      doDel({ids: ids});
    }
  });

  /* 显示表单弹窗 */
  function showEditModel(mData) {
    admin.open({
      type: 1,
      title: (mData ? '修改' : '添加') + '用户资料',
      maxmin:true,
      closeBtn:1,
      resize: true,
      shade: [0.8, "#393D49"],
      shadeClose:true,
      area:["1200px","1300px"],
      content: $('#appointmentsEditDialog').html(),
      success: function (layero, dIndex) {
        // 回显表单数据
        form.val('appointmentsEditForm', mData);
        if(!mData){
          // 110000,110100,110102
          $("#nativePlaceV, #liveCityV").val("330000,330200,330212")
        }
        // 表单提交事件
        form.on('submit(appointmentsEditSubmit)', function (data) {
          let loadIndex = layer.load(2);
          data.field.nativePlace=$("#nativePlaceV").next("div").find("div:eq(0)>input:eq(0)").val().replaceAll("/","").replaceAll(" ","")
          data.field.liveCity=$("#liveCityV").next("div").find("div:eq(0)>input:eq(0)").val().replaceAll("/","").replaceAll(" ","")
          admin.req('/appo/appointments', data.field, function (res) {
            layer.close(loadIndex);
            if (0 === res.code) {
              layer.msg(res.msg, {icon: 1});
              insTb.reload({page: {curr: 1}});
              layer.close(dIndex);
            } else {
              layer.msg(res.msg, {icon: 2, anim: 6});
            }
          }, mData ? 'put' : 'post');
          $("button[lay-filter='appointmentsEditSubmit']").attr("disabled","disabled");
          setTimeout(function(){$("button[lay-filter='appointmentsEditSubmit']").removeAttr("disabled");}, 1000 )
          return false;
        });

        try {
          // let ad = mData.idCardPic.split(',')
          // ad.forEach((index2,item2) => {
          //   if(index2==''||index2==undefined){return true}
          //   $('#idCardPic_preview').append('<span style="position: relative;margin-right: 7px;">' +
          //     '<img src="'+setter.baseServer +'/file/' + index2 +'" alt="照片'
          //     +'" class="layui-upload-img" style="width: 150px;height: 150px;"> ' +
          //     '<span class="layui-layer-setwin" style="top: -51px;right: 21px;">' +
          //     '<a class="layui-layer-ico  layui-layer-close2 pic_remove_class" ' +
          //     'data-src="'+index2+'" data-picRemoveActual="false" ' +
          //     'data-picId="idCardPic_pic" data-picRemoveId="idCardPic_picRemove" '  +
          //     'href="javascript:void(0);">' +
          //     '</a></span></span> ')
          // })
          // ad = mData.educationPic.split(',')
          // ad.forEach((index2,item2) => {
          //   if(index2==''||index2==undefined){return true}
          //   $('#educationPic_preview').append('<span style="position: relative;margin-right: 7px;">' +
          //       '<img src="'+setter.baseServer +'/file/' + index2 +'" alt="照片'
          //       +'" class="layui-upload-img" style="width: 150px;height: 150px;"> ' +
          //       '<span class="layui-layer-setwin" style="top: -51px;right: 21px;">' +
          //       '<a class="layui-layer-ico  layui-layer-close2 pic_remove_class" ' +
          //       'data-src="'+index2+'" data-picRemoveActual="false" ' +
          //       'data-picId="educationPic_pic" data-picRemoveId="educationPic_picRemove" '  +
          //       'href="javascript:void(0);">' +
          //       '</a></span></span> ')
          // })

          let ad = mData.photo.split(',')
          ad.forEach((index2,item2) => {
            if(index2==''||index2==undefined){return true}
            $('#photo_preview').append('<span style="position: relative;margin-right: 7px;">' +
                '<img src="'+setter.baseServer +'/file/' + index2 +'" alt="照片'
                +'" class="layui-upload-img" style="width: 150px;height: 150px;"> ' +
                '<span class="layui-layer-setwin" style="top: -51px;right: 21px;">' +
                '<a class="layui-layer-ico  layui-layer-close2 pic_remove_class" ' +
                'data-src="'+index2+'" data-picRemoveActual="false" ' +
                'data-picId="photo_pic" data-picRemoveId="photo_picRemove" '  +
                'href="javascript:void(0);">' +
                '</a></span></span> ')
          })
          let photo_privacy = mData.photoPrivacy.split(',')
          photo_privacy.forEach((index2,item2) => {
            if(index2==''||index2==undefined){return true}
            $('#photo_privacy_preview').append('<span style="position: relative;margin-right: 7px;">' +
                '<img src="'+setter.baseServer +'/file/' + index2 +'" alt="照片'
                +'" class="layui-upload-img" style="width: 150px;height: 150px;"> ' +
                '<span class="layui-layer-setwin" style="top: -51px;right: 21px;">' +
                '<a class="layui-layer-ico  layui-layer-close2 pic_remove_class" ' +
                'data-src="'+index2+'" data-picRemoveActual="false" ' +
                'data-picId="photo_privacy_pic" data-picRemoveId="photo_privacy_picRemove" '  +
                'href="javascript:void(0);">' +
                '</a></span></span> ')
          })
        } catch (e) {
        }
        //多图片上传
        upload.render({
          elem: '#idCardPic_upload'
          ,url: setter.baseServer + '/file/upload' //改成您自己的上传接口
          ,headers: {'Authorization': 'Bearer ' + setter.getToken().access_token}
          ,multiple: true
          ,before: function(obj){
            //预读本地文件示例，不支持ie8
            obj.preview(function(index, file, result){
              $('#idCardPic_preview').append('<span style="position: relative;margin-right: 7px;">' +
                  '<img src="' + result +'" alt="照片'
                  +'" class="layui-upload-img" style="width: 150px;height: 150px;"> ' +
                  '<span class="layui-layer-setwin" style="top: -51px;right: 21px;">' +
                  '<a class="layui-layer-ico  layui-layer-close2 pic_remove_class" ' +
                  'data-src="" data-picRemoveActual="true" ' +
                  'data-picId="idCardPic_pic" data-picRemoveId="idCardPic_picRemove" '  +
                  'href="javascript:void(0);">' +
                  '</a></span></span> ')
            });
          }
          ,done: function(res, index, upload){ //上传后的回调
            let add_pic_add = ''
            if($("#idCardPic_pic").val()!=''){
              add_pic_add += $("#idCardPic_pic").val() + ','
            }
            $("#idCardPic_pic").val(add_pic_add+res.url)
            $('#idCardPic_preview>span:last>span:last>a')[0].dataset.src=res.url
          }
          ,accept: 'images' //允许上传的文件类型
          ,size: 600  //最大允许上传的文件大小
        });

        //多图片上传
        upload.render({
          elem: '#educationPic_upload'
          ,url: setter.baseServer + '/file/upload' //改成您自己的上传接口
          ,headers: {'Authorization': 'Bearer ' + setter.getToken().access_token}
          ,multiple: true
          ,before: function(obj){
            //预读本地文件示例，不支持ie8
            obj.preview(function(index, file, result){
              $('#educationPic_preview').append('<span style="position: relative;margin-right: 7px;">' +
                  '<img src="' + result +'" alt="照片'
                  +'" class="layui-upload-img" style="width: 150px;height: 150px;"> ' +
                  '<span class="layui-layer-setwin" style="top: -51px;right: 21px;">' +
                  '<a class="layui-layer-ico  layui-layer-close2 pic_remove_class" ' +
                  'data-src="" data-picRemoveActual="true" ' +
                  'data-picId="educationPic_pic" data-picRemoveId="educationPic_picRemove" '  +
                  'href="javascript:void(0);">' +
                  '</a></span></span> ')
            });
          }
          ,done: function(res, index, upload){ //上传后的回调
            // console.log(res, index, upload)
            let add_pic_add = ''
            if($("#educationPic_pic").val()!=''){
              add_pic_add += $("#educationPic_pic").val() + ','
            }
            $("#educationPic_pic").val(add_pic_add+res.url)
            $('#educationPic_preview>span:last>span:last>a')[0].dataset.src=res.url
          }
          ,accept: 'images' //允许上传的文件类型
          ,size: 600  //最大允许上传的文件大小
        });

        //多图片上传
        upload.render({
          elem: '#photo_upload'
          ,url: setter.baseServer + '/file/upload' //改成您自己的上传接口
          ,headers: {'Authorization': 'Bearer ' + setter.getToken().access_token}
          ,multiple: true
          ,before: function(obj){
            //预读本地文件示例，不支持ie8
            obj.preview(function(index, file, result){
              $('#photo_preview').append('<span style="position: relative;margin-right: 7px;">' +
                  '<img src="' + result +'" alt="照片'
                  +'" class="layui-upload-img" style="width: 150px;height: 150px;"> ' +
                  '<span class="layui-layer-setwin" style="top: -51px;right: 21px;">' +
                  '<a class="layui-layer-ico  layui-layer-close2 pic_remove_class" ' +
                  'data-src="" data-picRemoveActual="true" ' +
                  'data-picId="photo_pic" data-picRemoveId="photo_picRemove" '  +
                  'href="javascript:void(0);">' +
                  '</a></span></span> ')
            });
          }
          ,done: function(res, index, upload){ //上传后的回调
            // console.log(res, index, upload)
            let add_pic_add = ''
            if($("#photo_pic").val()!=''){
              add_pic_add += $("#photo_pic").val() + ','
            }
            $("#photo_pic").val(add_pic_add+res.url)
            $('#photo_preview>span:last>span:last>a')[0].dataset.src=res.url
          }
          ,accept: 'images' //允许上传的文件类型
          ,size: 600  //最大允许上传的文件大小
        });

        //多图片上传
        upload.render({
          elem: '#photo_privacy_upload'
          ,url: setter.baseServer + '/file/upload' //改成您自己的上传接口
          ,headers: {'Authorization': 'Bearer ' + setter.getToken().access_token}
          ,multiple: true
          ,before: function(obj){
            //预读本地文件示例，不支持ie8
            obj.preview(function(index, file, result){
              $('#photo_privacy_preview').append('<span style="position: relative;margin-right: 7px;">' +
                  '<img src="' + result +'" alt="照片'
                  +'" class="layui-upload-img" style="width: 150px;height: 150px;"> ' +
                  '<span class="layui-layer-setwin" style="top: -51px;right: 21px;">' +
                  '<a class="layui-layer-ico  layui-layer-close2 pic_remove_class" ' +
                  'data-src="" data-picRemoveActual="true" ' +
                  'data-picId="photo_privacy_pic" data-picRemoveId="photo_privacy_picRemove" '  +
                  'href="javascript:void(0);">' +
                  '</a></span></span> ')
            });
          }
          ,done: function(res, index, upload){ //上传后的回调
            // console.log(res, index, upload)
            let add_pic_add = ''
            if($("#photo_privacy_pic").val()!=''){
              add_pic_add += $("#photo_privacy_pic").val() + ','
            }
            $("#photo_privacy_pic").val(add_pic_add+res.url)
            $('#photo_privacy_preview>span:last>span:last>a')[0].dataset.src=res.url
          }
          ,accept: 'images' //允许上传的文件类型
          ,size: 600  //最大允许上传的文件大小
        });

        // 籍贯 省市区选择
        cascader.render({
          elem: '#nativePlaceV',
          data: citysData,
          itemHeight: '250px',
          filterable: true,
          value: ["330000","330200","330205"],
        });
        // 籍贯 省市区选择
        cascader.render({
          elem: '#liveCityV',
          data: citysData,
          itemHeight: '250px',
          filterable: true,
          value: ["330000","330200","330205"],
        });
        laydate.render({
          elem: '#birthday'
          ,type: 'date'
          ,calendar: true
          ,mark: {
            '0-12-31': '跨年' //每年的日期
            // ,'0-0-20': '工资' //每月某天
            ,'2099-10-14': '呵呵'
          }
          ,done: function(value, date){
            if(date.date === 20){ //点击2017年8月15日，弹出提示语
              layer.msg('这一天是：玲珑骰子重要的日子',{time: 1000});
            }
          }
        });
        // 禁止弹窗出现滚动条
        $(layero).children('.layui-layer-content').css('overflow', 'visible');
      }
    });
  }
  $("body").on("click", ".pic_remove_class", function() {
    // admin.confirm('确定要删除此图片吗？', function (i) {
    //   layer.close(i);
    //   let loadIndex = layer.load(2);
      const dataset = $(this)[0].dataset
    console.log(dataset)
      const datasetSrc = dataset.src
      const picId = dataset.picid
      const picRemoveId = dataset.picremoveid
      let pic_tmp_str = $('#'+picId+'').val()
      pic_tmp_str = pic_tmp_str.replace(','+datasetSrc,'')
          .replace(datasetSrc+',','')
          .replace(datasetSrc,'')
      $(this).parent().parent().remove();
      $('#'+picId+'').val(pic_tmp_str)
      if(dataset.picremoveactual=='true') {
        //setter.baseServer + '/file
        admin.req('/file/remove', {'path': datasetSrc}, function (res) {
          // if (0 === res.code) {
          //   layer.msg(res.msg, {icon: 1});
          //   // insTb.reload({page: {curr: 1}});
          // } else {
          //   layer.msg(res.msg, {icon: 2, anim: 6});
          // }
          // layer.close(loadIndex)
        }, 'DELETE');
      } else {
        $('#'+picRemoveId+'').val($('#'+picRemoveId+'').val()+','+datasetSrc)
        // layer.close(loadIndex)
      }
    // });
  });



  /* 缴费*/
  function pay(mData) {
    admin.open({
      type: 1,
      title: '用户缴费',
      maxmin:true,
      closeBtn:1,
      resize: true,
      shade: [0.8, "#393D49"],
      shadeClose:true,
      offset: 'auto',
      area:["600px","350px"],
      content: $('#jfDialog').html(),
      success: function (layero, dIndex) {
        // 表单提交事件
        form.on('submit(jfEditSubmit)', function (data) {
          let loadIndex = layer.load(2);
          data.field['payUserId'] = mData.appoUserId
          data.field['type'] = '收款'
          data.field['feeName'] = mData.name + '缴费'
          data.field['matchMakerId'] = mData.matchMakerId
          admin.req('/appo/payRecord/pay', data.field, function (res) {
            layer.close(loadIndex);
            if (0 === res.code) {
              layer.msg(res.msg, {icon: 1});
              layer.close(dIndex);
            } else {
              layer.msg(res.msg, {icon: 2, anim: 6});
            }
          }, 'post');
          $("button[lay-filter='appointmentsEditSubmit']").attr("disabled","disabled");
          setTimeout(function(){$("button[lay-filter='appointmentsEditSubmit']").removeAttr("disabled");}, 1000 )
          return false;
        });
      }
    });
  }

  /* 介绍记录 */
  function intro(mData) {
    admin.open({
      type: 1,
      title: '介绍记录',
      maxmin:true,
      closeBtn:1,
      resize: true,
      shade: [0.8, "#393D49"],
      shadeClose:true,
      offset: 'auto',
      area:["600px","350px"],
      content: $('#introDialog').html(),
      success: function (layero, dIndex) {
        console.log(mData)
        // 表单提交事件
        form.on('submit(introEditSubmit)', function (data) {
          let loadIndex = layer.load(2);
          data.field['appoId'] = mData.id
          admin.req('/appo/introduction', data.field, function (res) {
            layer.close(loadIndex);
            if (0 === res.code) {
              layer.close(dIndex);
              layer.msg(res.msg, {icon: 1});
            } else {
              layer.msg(res.msg, {icon: 2, anim: 6});
            }
          }, 'post');
          $("button[lay-filter='appointmentsEditSubmit']").attr("disabled","disabled");
          setTimeout(function(){$("button[lay-filter='appointmentsEditSubmit']").removeAttr("disabled");}, 1000 )
          return false;
        });
        laydate.render({
          elem: '#introDate'
          ,type: 'datetime'
          ,calendar: true
          ,mark: {
            '0-12-31': '跨年' //每年的日期
            // ,'0-0-20': '工资' //每月某天
            ,'2099-10-14': '呵呵'
          }
          ,done: function(value, date){
            if(date.date === 20){ //点击2017年8月15日，弹出提示语
              layer.msg('这一天是：玲珑骰子重要的日子',{time: 1000});
            }
          }
        });
      }
    });
  }
  /* 审核 */
  function examine_dialog(mData) {
    admin.open({
      type: 1,
      title: '审核记录',
      maxmin:true,
      closeBtn:1,
      resize: true,
      shade: [0.8, "#393D49"],
      shadeClose:true,
      offset: 'auto',
      area:["600px","350px"],
      content: $('#examineDialog').html(),
      success: function (layero, dIndex) {
        form.render();
        // 表单提交事件
        form.on('submit(examineEditSubmit)', function (data) {
          data.field['id'] = mData.ids
          data.field['keywords'] = mData.keywords
          let loadIndex = layer.load(2);
          admin.req('/appo/appointments/updateExamined', data.field, function (res) {
            layer.close(loadIndex);
            if (0 === res.code) {
              layer.close(dIndex);
              layer.msg(res.msg, {icon: 1});
              insTb.reload({page: {curr: 1}});
            } else {
              layer.msg(res.msg, {icon: 2, anim: 6});
            }
          }, 'post');
          $("button[lay-filter='appointmentsEditSubmit']").attr("disabled","disabled");
          setTimeout(function(){$("button[lay-filter='appointmentsEditSubmit']").removeAttr("disabled");}, 1000 )
          return false;
        });
      }
    });
  }


  /* 删除 */
  function doDel(obj) {
    if (obj.ids) {
      admin.confirm('确定要删除选中数据吗？', function (i) {
        layer.close(i);
        let loadIndex = layer.load(2);
        admin.req('/appo/appointments/remove', {id: obj.ids}, function (res) {
          layer.close(loadIndex);
          if (0 === res.code) {
            layer.msg(res.msg, {icon: 1});
            insTb.reload({page: {curr: 1}});
          } else {
            layer.msg(res.msg, {icon: 2, anim: 6});
          }
        }, 'delete');
      });
    } else {
      let loadIndex = layer.load(2);
      admin.req('/appo/appointments/remove', obj.data, function (res) {
        layer.close(loadIndex);
        if (0 === res.code) {
          layer.msg(res.msg, {icon: 1});
          insTb.reload({page: {curr: 1}});
        } else {
          layer.msg(res.msg, {icon: 2, anim: 6});
        }
      }, 'delete');
    }
  }

  /* 点击图片放大 */
  $(document).off('click.tbImg').on('click.tbImg2', '[tb-img2]', function () {
    // var imgList = table.cache['customerTable'].map(function (d) {
    //     return {
    //         alt: d.nickName,
    //         src: d.imgUrl || '../../../assets/images/head.jpg'
    //     }
    // });
    // layer.photos({photos: {data: imgList, start: $(this).data('index')}, shade: .1, closeBtn: true});
    let imgList = [{alt:'身份证', src:$(this).data('src')}]
    layer.photos({photos: {data: imgList, start: 0}, shade: .1, closeBtn: true});
  });

  /* 点击图片放大 */
  $(document).off('click.tbImg').on('click.tbImg', '[tb-img]', function () {
    // var imgList = table.cache['customerTable'].map(function (d) {
    //     return {
    //         alt: d.nickName,
    //         src: d.imgUrl || '../../../assets/images/head.jpg'
    //     }
    // });
    // layer.photos({photos: {data: imgList, start: $(this).data('index')}, shade: .1, closeBtn: true});
    let imgList = []
    // console.log($(this).parent().html())
    layui.each($(this).parent().find('img'), function(index,item){
      imgList.push({alt:'照片', src: item.src})
    })
    // console.log(imgList)
    layer.photos({photos: {data: imgList, start: $(this).data('index')}, shade: .1, closeBtn: true,anim: 'kCATransitionFade'});
  });


});
</script>
